Skip to content

test: add expectTypeOf coverage for src/* type exports#151

Merged
metonym merged 1 commit into
masterfrom
metonym/fix-svelte-import-alias
Jul 5, 2026
Merged

test: add expectTypeOf coverage for src/* type exports#151
metonym merged 1 commit into
masterfrom
metonym/fix-svelte-import-alias

Conversation

@metonym

@metonym metonym commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Adds a type-level test suite (tests/unit/types.test-d.ts) that uses Vitest's expectTypeOf to assert on every exported type and function signature from src/*: IntersectActionOptions, IntersectGroupSharedOptions, IntersectGroupNodeOptions, IntersectionGroup, the intersect action, intersectAttachment, createIntersectionGroup, IntersectionObserverState, createIntersectionObserver, and the props/bindings of both the IntersectionObserver and MultipleIntersectionObserver components. Imports use the real package subpaths (e.g. svelte-intersection-observer/IntersectionObserver.svelte) via the existing tsconfig path mapping, rather than relative paths into src.

vitest.config.ts now enables typecheck, scoped to tests/unit/**/*.test-d.ts, so these run alongside the regular suite in a single vitest run/test:unit invocation with no separate command needed.

Low risk: this only adds a new test file and a scoped config option. The main thing to watch is that the typecheck runner adds a bit of extra time to test:unit (a few seconds, spawns tsc), and that future changes to the public type exports will now fail CI if they drift from these assertions, which is the intended effect.

Enables Vitest's typecheck runner (scoped to tests/unit/**/*.test-d.ts)
so it runs alongside the regular suite via `vitest run`, and adds
type-level assertions for every exported type/signature in src/*:
the intersect action, intersectAttachment, createIntersectionGroup,
createIntersectionObserver, and both components' prop/bindable shapes.
@render
render Bot temporarily deployed to metonym/fix-svelte-import-alias - svelte-intersection-observer PR #151 July 5, 2026 19:36 Destroyed
@metonym
metonym merged commit ba92627 into master Jul 5, 2026
2 checks passed
@metonym
metonym deleted the metonym/fix-svelte-import-alias branch July 5, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant